﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class ProductDetailsForm : Form
    {
        public Product Product { get; set; }

        public ProductDetailsForm()
        {
            InitializeComponent();

            TextBoxHelper.InitHelp(textBox1, "Enter bar code");
            TextBoxHelper.InitHelp(textBox2, "Enter name");
            TextBoxHelper.InitHelp(textBox3, "Use dot (.) as separator. Ex: 10.53");
            TextBoxHelper.InitHelp(textBox4, "Use dot (.) as separator. Ex: 10.53");
            comboBox2.SelectedIndex = 0;
            comboBox1.SelectedIndex = 0;
        }

        private void ProductDetailsForm_Load(object sender, EventArgs e)
        {
            if (Product != null)
            {
                textBox1.Text = Product.barCode;
                textBox2.Text = Product.name;
             //   comboBox1.SelectedItem = Product.department;
             //   dateTimePicker1.Value = Product.expirationDate;
              //  textBox3.Text = Product.price.ToString();
               // textBox4.Text = Product.quantity.ToString();
              //  comboBox2.SelectedItem = Product.unitOfMeasure;
            }
            else
            {
                Product = new Product();
            }
            comboBox2.SelectedIndex = 0;
            comboBox1.SelectedIndex = 0;
        }

       

        private void button2_Click(object sender, EventArgs e)
        {
            string msg = TextBoxHelper.HasText(textBox1).ToString();
            MessageBox.Show(msg);
        }

        private void OKBtn_Click(object sender, EventArgs e)
        {
           /* string msg = TextBoxHelper.HasText(textBox1).ToString();
            MessageBox.Show(msg);*/

            Product.barCode = textBox1.Text;
            Product.name = textBox2.Text;
            //Product.department = (int)comboBox1.SelectedItem;
          //  Product.expirationDate = dateTimePicker1.Value;
          //  Product.price =Convert.ToDouble(textBox3.Text);
          //  Product.quantity = Convert.ToDouble(textBox4.Text);
            //Product.unitOfMeasure = (string)comboBox2.SelectedItem;

        }

        private void CancelBtn_Click(object sender, EventArgs e)
        {
            Close();
        }

       
       
    }
}
